<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
<script type="text/javascript" src="../../res/js/jquery-3.1.1.min.js"></script>
<script  type="text/javascript"   src="../../res/layui/layui.js"></script>
<script src="../../res/js/Tools.js"></script>
<body>
<form>
    <input type="hidden" name="athleteId" id="athleteId">
    <div class="layui-form-item" id="name">
        <label class="layui-form-label">方案名称</label>
        <p name="schemeName" id="schemeName"  ></p>
    </div>
    <div class="layui-form-item"  id="applyForExp">
        <label class="layui-form-label">申请理由</label>
        <p name="coachId"  >
        </p>
    </div>
    <div class="layui-form-item"  id="coachId">
        <label class="layui-form-label">教练姓名</label>
        <p name="coachId"  >
        </p>
    </div>
    <div class="layui-input-block">
        <input type="button" class="layui-btn" lay-submit="" lay-filter="demo" onclick=queren() value="同意"></input>
        <input type="button" class="layui-btn" lay-submit="" lay-filter="demo" onclick=buqueren() value="不同意"></input>
    </div>

</div>
</form>
</body>
<script>
    var schemeId = getQueryString("schemeId");
    function queren(){
       /* var i = window.parent.layer.getFrameIndex();
        window.parent.layer.close(i);*/


        layer.open({
            type: 2,
            title: '修改',
            closeBtn: 1, //不显示关闭按钮
            shade: [0],//背景色透明度
            area: ['80%', '90%'],
            anim: 2,//动画效果
            content: ['accept.html?schemeId=' + schemeId, 'no'],
            end: function () {
                var indexs = parent.layer.getFrameIndex(window.name);
                parent.layer.close(indexs);
            }
        });
    }
    function buqueren(){
        /* var i = window.parent.layer.getFrameIndex();
         window.parent.layer.close(i);*/


        layer.open({
            type: 2,
            title: '修改',
            closeBtn: 1, //不显示关闭按钮
            shade: [0],//背景色透明度
            area: ['80%', '90%'],
            anim: 2,//动画效果
            content: ['noaccept.html?schemeId=' + schemeId, 'no'],
            end: function () {
                var indexs = parent.layer.getFrameIndex(window.name);
                parent.layer.close(indexs);
            }
        });
    }
    layui.use('form',function(){
        var form = layui.form;
        var url2 = "../../atsScheme/findExpert";
        var data = {schemeId:schemeId};
        $.post(url2,data,function(obj){
            $.each(obj,function(index,items){
                $("#applyForExp").append(' <p name="applyForExp" id="applyForExp" style="margin-top:10px;margin-left:100px;padding-top:10px" >'+items.applyForExp+'</p>');
            })
        },'json');
        var url = "../../atsScheme/findById";


        $.post(url,data,function(obj){

            $("#schemeId").val(obj.schemeId);
            $("#name").append(' <p name="schemeName" id="schemeName" style="margin-top:10px;margin-left:100px;padding-top:10px" >'+obj.schemeName+'</p>');

            //下拉框
            var url = "../../atsScheme/findselect";
            $.post(url,null,function(data){

                $.each(data,function(index,item){
                    if(item.coachId==obj.coachId){
                        $("#"+obj.coachId).prop("selected","selected");
                        $("#coachId").append('<p style="margin-left:100px;padding-top:10px" >'+obj.coachName+'</p>');

                        form.render("select");

                    }
                    return ;
                });
            });
        });
    });
</script>
</html>